package 封装;

/**
 * @author chenmin
 * @desc TODO
 * @date 2025/9/2
 */
public class Teacher {


    //私有的属性
    private String name;
    private long num;
    private char gender;
    private int age;
    private String major;


    //成员方法
    public void work(){
        System.out.println("一位"+major+"学科的老师在工作~");
    }

    public void eat(){
        System.out.println(name+"在吃饭~");
    }

    //构造方法
    public Teacher() {
    }

    public Teacher(String name, long num, char gender, int age, String major) {
        this.name = name;
        this.num = num;
        this.gender = gender;
        this.age = age;
        this.major = major;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public long getNum() {
        return num;
    }


    public void setNum(long num) {
        this.num = num;
    }


    public char getGender() {
        return gender;
    }


    public void setGender(char gender) {
        this.gender = gender;
    }


    public int getAge() {
        return age;
    }


    public void setAge(int age) {
        this.age = age;
    }


    public String getMajor() {
        return major;
    }


    public void setMajor(String major) {
        this.major = major;
    }

    //toString 输出对象的信息
    public String toString() {
        return "Teaxher{name = " + name + ", num = " + num + ", gender = " + gender + ", age = " + age + ", major = " + major + "}";
    }
}